package com.ferret.scheduler;


import com.ferret.service.ReadPicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

@Component
public class DownLoadPicScheduler {


    @Autowired
    private ReadPicService readPicService;

    @PostConstruct
    // 每天凌晨1点执行
//    @Scheduled(cron = "0 0 1 * * ?")
    private void bigDataStatisticsScheduler() {
        // 获取昨天的日期
        LocalDate yesterday = LocalDate.now().minusDays(1);
        // 昨天凌晨0点整
        LocalDateTime startTime = LocalDateTime.of(yesterday, LocalTime.MIN);
        // 昨天23:59:59
        LocalDateTime endTime = LocalDateTime.of(yesterday, LocalTime.MAX);
        //按时间-区域-状态查询

        readPicService.selectConditionPicByAreaCodes(null, "1", startTime, endTime);
    }
}
